package com.leyou.test;

import com.leyou.item.LyItemServiceApplication;
import com.leyou.item.mapper.SkuMapper;
import com.leyou.item.pojo.Sku;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.File;
import java.util.List;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = LyItemServiceApplication.class)
public class UpdateImage {
    @Autowired
    private SkuMapper skuMapper;

    @Test
    public void fun1(){
        List<Sku> skus = skuMapper.selectAll();
        for(Sku sku:skus){
            String images = sku.getImages().replace("image.leyou.com", "47.104.250.184");
            System.out.println(images);
            sku.setImages(images);
            skuMapper.updateByPrimaryKeySelective(sku);
        }
    }



}
